style: Don't use gdk_pixmap_create_from_xpm
authorBenjamin Otte <otte@redhat.com>
Fri, 6 Aug 2010 14:02:24 +0000 (16:02 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 10 Aug 2010 19:02:30 +0000 (21:02 +0200)
Instead, do what that code did manually.

gtk/gtkstyle.c

index f5c745d9b2c4a0f7650c356577ace444a1666c22..9b615d4fad1a272c5362d1f5039d73875d31c2cb 100644 (file)
@@ -1247,9 +1247,33 @@ load_bg_image (GdkColormap *colormap,
     return (GdkPixmap*) GDK_PARENT_RELATIVE;
   else
     {
-      return gdk_pixmap_colormap_create_from_xpm (NULL, colormap, NULL,
-                                                 bg_color,
-                                                 filename);
+      GdkPixmap *pixmap;
+      GdkPixbuf *pixbuf;
+      cairo_t *cr;
+      GdkScreen *screen = gdk_colormap_get_screen (colormap);
+  
+      pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+      if (!pixbuf)
+        return NULL;
+
+      pixmap = gdk_pixmap_new (gdk_screen_get_root_window (screen),
+                               gdk_pixbuf_get_width (pixbuf),
+                               gdk_pixbuf_get_height (pixbuf),
+                               gdk_colormap_get_visual (colormap)->depth);
+      gdk_drawable_set_colormap (pixmap, colormap);
+  
+      cr = gdk_cairo_create (pixmap);
+
+      gdk_cairo_set_source_color (cr, bg_color);
+      cairo_paint (cr);
+
+      gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
+      cairo_paint (cr);
+
+      cairo_destroy (cr);
+      g_object_unref (pixbuf);
+
+      return pixmap;
     }
 }